{extend name="public/base" /}

{block name="title"}{$article.title} - {$sysInfo.webname}{/block} 
{block name="keywords"}{$article.keywords ?: $article.title}{/block}
{block name="description"}{$article.title},{$article.description}{/block}
{block name="ogtitle"}<meta property="og:title" content="{$article.title} - {$sysInfo.webname}">{/block}
{block name="ogdescription"}<meta property="og:description" content="{$article.title},{$article.description ?? ''}" />{/block}
{block name="meta"}
<meta property="og:type" content="article"/>
<meta property="article:published_time" content="{$article.create_time|date='c'}"/>
<meta property="bytedance:published_time" content="{$article.create_time|date='c'}" />
<meta property="bytedance:lrDate_time" content="{$lrDate_time|date='c'}" />
<meta property="bytedance:updated_time" content="{$article.update_time|date='c'}" />
{/block}
{block name="link"}
<link rel="stylesheet" type="text/css" href="/addons/taoplayer/ckplayer/css/ckplayer.css">
{/block}
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
{block name="content"}
<div class="layui-container article-content" style="max-width: 1864px;">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        {//播放器}
        <div class="video" style="width: 100%;height: 500px;"></div>

        {//作者}
        <div class="detail-about" style="margin-top: 10px;">
          <a class="fly-avatar" href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}">
            <img src="{$Request.domain}{$article.user.user_img}" alt="{$article.user.name}">
            {if($article.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
          </a>
          <div class="fly-detail-user">
            <a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}" class="fly-link"><cite>{$article.user.nickname ?: $article.user.name}</cite></a>
            <span class="layui-btn layui-btn-danger layui-btn-xs guanzhu" >关注</span>
          </div>
          <div class="detail-hits">
            <!--span style="padding-right: 10px; color: #FF7200">悬赏：60飞吻</span-->
            <span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
            {:hook('ipShow',$article.user.city)}
          </div>
        </div>

        <hr>

        {//标题}
        <h1 style="font-size: 20px;line-height: 28px;">{$article.title}</h1>

        {//图标}
        <div class="fly-detail-info">
          原创 · {$pv}万次观看
              <span class="layui-badge layui-bg-green fly-detail-column">{:cookie('think_lang') == 'en-us' ? $article.cate.ename : $article.cate.catename}</span>
              {if ($article.is_top == 1)}<span class="layui-badge layui-bg-black">{:lang('top')}</span>{/if}
		      {if ($article.is_good == 1)}<span class="layui-badge layui-bg-red">{:lang('hot')}</span>{/if}
		      <span id="LAY_jieAdmin" data-id="{$article['id']}"></span>

		      <div class="fly-list-nums">
                点赞
			    <a href="#comment"><i class="iconfont" title="{:lang('reply')}">&#xe60c;</i>{article:comments_num /}</a><i class="iconfont" title="浏览">&#xe60b;</i>{$pv}
		      </div>
        </div>

        {//评论内容}
        <div class="detail-box" id="flyReply">

          {//评论}
          {if session('?user_id') AND ( config('taoler.config.is_reply') == 1 ) AND ( $article.is_reply == 1 )}
          <div class="layui-form layui-form-pane">
            <div class="layui-form-item layui-form-text">
              <a name="comment"></a>
              <div class="layui-input-block">
                <textarea id="Lcontent" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}"  class="layui-textarea fly-editor" style="height: 80px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <input type="hidden" name="article_id" value="{$article.id}">
              <input type="hidden" name="user_id" value="{:session('user_id')}">
              <button class="layui-btn" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
            </div>
          </div>
          {/if}

          <ul class="jieda" id="jieda">
            {volist name="comments" id="vo" empty= ""}
            <li data-id="{$vo.id}" class="jieda-daan">
              <a name="item-1111111111"></a>
              <div class="detail-about detail-about-reply">
                <a class="fly-avatar" href="{$Request.domain}{:url('user/home',['id'=>$vo.user_id])}">
                  <img src="{$Request.domain}{$vo.user.user_img}" alt=" ">
                </a>
                <div class="fly-detail-user">
                  <a href="{$Request.domain}{:url('user/home',['id'=>$vo.user.id])}" class="fly-link"><cite>{$vo.user.nickname ?: $vo.user.name}</cite></a>
                  {if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
                </div>
                <div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span>{:hook('ipShow',$vo.user.city)}</span></div>
                <div class="detail-body jieda-body photos">{$vo.content|raw}</div>
              </div>

              <div class="jieda-reply" style="margin-left:50px;">
                <span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan"><i class="iconfont icon-zan"></i><em>{$vo.zan}</em></span>
                <span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
                {//评论编辑删除采纳权限}
                <div class="jieda-admin">
                  {if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth  ?? '')}
                  <span type="edit" class="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
                  <span type="del">{:lang('delete')}</span>
                  {/if}
                  {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth  ?? '')) /}
                  <span class="jieda-accept" type="accept">{:lang('accept')}</span>
                  {/if}
                </div>
              </div>
            </li>
            {/volist}
          </ul>
          <div style="text-align: center" id="pages"></div>
        </div>
      </div>

    </div>

    {//右栏}
    <div class="layui-col-md4">
      <div class="fly-panel">
        <div class="fly-panel-main wenda-user">
          <div class="user-img">
            <a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}">
              <img class="" src="{$Request.domain}{$article.user.user_img}" alt="{$article.user.name}" />
              {if($article.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
            </a>
          </div>
          <div class="questions">
            <span class="layui-badge layui-bg-green">+ 关注</span>
          </div>
        </div>
      </div>
      {if showSlider(7)}
      <div class="fly-panel">
        <div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
          <a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
        </div>
        <div class="fly-panel-main">
          {volist name="ad_comm" id="vo"}
          <a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
          {/volist}
        </div>
      </div>
      {/if}
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">{:lang('hot post list')}</dt>
          {volist name="artHot" id="vo"}
          <dd>
            <a href="{$Request.domain}{$vo.url}">{$vo.title}</a>
            <span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
          </dd>
          {/volist}
      </dl>
      {if showSlider(4)}
      <div class="fly-panel" style="padding: 5px 0; text-align: center;">
      {volist name="ad_art" id="vo"}
        <a href="{$vo.slid_href}" target="_blank"><img src="{$Request.domain}{$vo.slid_img}" style="max-width: 100%;"></a>
      {/volist}
      </div>
      {/if}
    </div>
    {//crud管理模块}
    {include file="/public/crud" /}
  </div>
  <!--底部栏-->
  <div class="site-tree-mobile-detail-bottom layui-hide-md">
    <div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
  </div> 
</div>
{include file="public/menu" /}
{/block}
{block name="script"}

{:hook('taonyeditor')}

{:hook('taoplayer')}

<script>
var collectionFind = "{:url('Collection/find')}",
    collection = "{:url('collection/')}",
    articleJieset = "{:url('Article/jieset')}",
    articleDelete = "{:url('Article/delete')}",
    commentJiedaZan = "{:url('Comment/jiedaZan')}",
    commentJiedaCai = "{:url('Comment/jiedaCai')}",
    commentGetDa = "{:url('Comment/getDa')}",
    commentUpdateDa = "{:url('Comment/updateDa')}",
    commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
    langCollection = "{:lang('collection')}",
    langCancelCollection = "{:lang('cancel collection')}";
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
	var $ = layui.jquery
	,form = layui.form
	,fly = layui.fly
	,colorpicker = layui.colorpicker
	,laytpl = layui.laytpl
	,uid = layui.cache.user.uid
	,laypage = layui.laypage;
  var id = "{$article.id}";


    $(".comment-edit").on('click',function (){
      var id = $(this).data('id');
      layer.open({
        type: 2,
        title: '修改',
        shade: 0.1,
        area: ['600px', '500px'],
        content: "{:url('comment/edit')}" + '?id=' + id
      });
    });

  //文章点赞
  $("#article-zan").on('click',function(){
    //判断登陆
    if(uid == -1){
          layer.msg('请登录再点赞', {icon: 6}, function(){location.href = login})
          return false;
        }
    $.post("{:url('article/userZanArticle')}",{article_id:id,type:1},function(data){
      if(data.code == 0){
          layer.msg(data.msg,{icon:6,time:2000},function () {
                location.reload(true);
            });
        } else {
          layer.msg(data.msg,{icon:6,adim:6});
        }
    })
  });
  
  //评论需要登陆
  form.on('submit(user-comment)',function (data){
	  var index = layer.load(1);
	  var filed = data.field;
    if (uid == -1) {
			layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
    } else {
      $.ajax({
        type: "post",
        url: "{:url('article/comment')}",
        data: filed,
        dataType: "json",
        success:function (data) {
          if (data.code === 0) {
            layer.msg(data.msg,{icon:6,time:2000},function () {
                location.reload(true);
            });
          }else {
            layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
          }
        }
      });
    }
    return false;
  });

  // 评论分页
  laypage.render({
    elem: "pages", //注意，这里的 test1 是 ID，不用加 # 号
    count: "{article:comments_num /}", //数据总数，从服务端得到
    limit: 10,
    curr: "{$page}",
    //获取起始页
    jump: function (obj, first) {
      var page = obj.curr;
      var limit = obj.limit;
      var  url = "{:url('article_detail',['id' => $article.id ,'ename' =>$article['cate']['ename']])}";
      var id = "{$article.id}";
      //首次不执行
      if (!first) {
        $.post("{:url('article/detail')}", { id: id, page: page }, function () {
          location.href = url + '?page=' + page + '#flyReply';
        });
      }
    },
  });
	
	//下载
    $('#zip-download').click(function (){
	  var id = "{$article.id}";
      $.ajax({
        type:"post",
        url:"{:url('article/download')}",
        data:{id:id},
        success:function (data) {
          location.href = "{:url('article/download',['id'=>$article.id])}"; 
        }
      });
    });
});
</script>

{:hook('taoplyr')}

{/block}